home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oh!X 2001 Spring
/
Oh!X 2001 Spring Special CD-ROM (Japan).7z
/
Oh!X 2001 Spring Special CD-ROM (Japan) (Track 1).bin
/
PUZZLE
/
puz01
/
fact.c
next >
Wrap
C/C++ Source or Header
|
2000-02-20
|
349b
|
29 lines
/*
* fact.c : 階乗の計算
*
*/
#include <stdio.h>
int fact( int n )
{
if( n == 0 ){
return 1;
} else {
return n * fact(n - 1);
}
}
int main()
{
int i, j;
/* 13 でオーバーフロー */
for( i = 0; i < 13; i++ ){
j = fact( i );
printf("%d! = %d\n", i, j );
}
return 0;
}
/* end of file */